package com.sctvcloud.dongqu.beans;

import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.ruihang.generalibrary.utils.IDataDate;

import java.sql.Date;

/**
 * Created by Administrator on 2017/10/12 0012.
 */

public class SimpleDataDate implements IDataDate {

    private Date temp;
    private String pattern;
    private String dateStr;

    public SimpleDataDate(String pattern) {
        this.pattern = pattern;
    }

    public SimpleDataDate(String pattern, String dateStr) {
        this.pattern = pattern;
        this.dateStr = dateStr;
    }

    @Override
    public Date getDataDate() {
        return temp;
    }

    @Override
    public void setDataDate(Date date) {
        this.temp = date;
    }

    @NonNull
    @Override
    public String getDatePattern() {
        return pattern;
    }

    @Override
    public String getDateString() {
        return dateStr;
    }

    public void setPattern(String pattern) {
        boolean b = !TextUtils.equals(pattern, this.pattern);
        this.pattern = pattern;
        if (b) {
            temp = null;
        }
    }

    public void setDateStr(String dateStr) {
        boolean b = !TextUtils.equals(dateStr, this.dateStr);
        this.dateStr = dateStr;
        if (b) {
            temp = null;
        }
    }
}
